class Solution
{
public:
    vector<int> distributeCandies(int candies, int num_people)
    {
        vector<int> result(num_people, 0);
        int round = 1;
        while (true)
        {
            if (candies <= round)
            {
                result[(round - 1) % num_people] += candies;
                break;
            }
            else
            {
                result[(round - 1) % num_people] += round;
                candies -= round;
            }
            ++round;
        }
        return result;
    }
};